package com.wechat.mp.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wechat.mp.entity.Test;
import com.wechat.mp.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-10-19
 */
@RestController
@RequestMapping("/mp/test")
public class TestController {

    @Autowired
    TestService testService;

    @RequestMapping("/aaa")
    public List<Test> aaaa(){
        IPage<Test> userPage = new Page<>(2, 3);//参数一是当前页，参数二是每页个数
        userPage = testService.page(userPage, null);
        List<Test> records = userPage.getRecords();

//        QueryWrapper<Test> tWrapper = new QueryWrapper<Test>();
//        tWrapper.like("name","三");
//        List<Test> list = testService.list(tWrapper);
//        Test byId = testService.getById(1);
        return records;
    }
}

